package com.yy.controller;

import com.yy.clientEntities.TestData;
import com.yy.service.SentinelService;
import com.yy.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;

/**
 * Author young
 * Date 2023/1/12 9:21
 * Description: SpringCloudAlibaba
 */
@RequestMapping("/cs")
@RestController
public class ConsumerSentinelServiceController {
    @Autowired
    private SentinelService sentinelService;
    
    @GetMapping("all")
    public Result<Collection<TestData>> all(){
        return sentinelService.all();
    }
    
    @GetMapping("one/{id}")
    public Result<TestData> one(@PathVariable("id")Integer id){
        return sentinelService.findOne(id);
    }
}
